

#ifndef __IOT_SERVER_H__
#define __IOT_SERVER__
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <elog.h>

#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>			/* See NOTES */
#include <sys/socket.h>
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
#include <sqlite3.h>
#include <signal.h>


#define SIZE 1024
#define LEN_MONI 7 //监控数据的字节数为7

//实现和移动端通信用的标志
#define DEV_ID_STR  			"peripheral"
#define MOBL_ID_STR  		 	"mobile"
#define SER_ACK_YES             "yes"
#define SER_ACK_NO              "no"
#define SER_ACK_OK              "ok"
#define SER_REQ_LOGIN_HEAD  	"login"
#define SER_REQ_REG_HEAD      	"register"
#define SER_REQ_CMD_HEAD      	"control"
#define SER_REQ_BIND_HEAD     	"bind"
#define SER_REQ_MONI_HEAD		"monitor"
#define SER_REQ_MONI_INFO		"monitor_info"
#define SER_REQ_MONI_END		"stop_moninfo_send"


extern char send_mob_buf[SIZE]; //发送监控数据字符串给移动端的缓冲区
extern pthread_mutex_t coord_mutex;

void* recv_coord_thread(void *arg);
void* recv_mob_thread(void *arg);

int do_login(char *uname, char *pass);


#endif
